package com.wanyang.dto;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.Collections;
import java.util.List;

@Data
public class PostPublishFleaMarket extends PostPublishBase {
    FleaMarket fleaMarket;

    @Data
    public static class FleaMarket {
        @ApiModelProperty(value = "1-求购，2-转卖")
        private Integer type;
        @ApiModelProperty(value = "求购内容")
        private String buyDetail;
        @ApiModelProperty(value = "求购 - 联系人")
        private String buyContact;
        @ApiModelProperty(value = "求购 - 联系电话")
        private String buyMobile;

        @ApiModelProperty(value = "转卖内容")
        private String sellDetail;
        @ApiModelProperty(value = "转卖内容 所有图片")
        private List<String> imgList;
        @ApiModelProperty(value = "转卖 - 联系人")
        private String sellContact;
        @ApiModelProperty(value = "转卖 - 联系电话")
        private String sellMobile;

    }

    @Override
    public Object getDetailObject() {
        return fleaMarket;
    }

    @Override
    public AuditObject getNeedAuditObject() {
        AuditObject auditObject = new AuditObject();
        auditObject.setContents(fleaMarket.type == 1 ?
                Collections.singletonList(fleaMarket.buyDetail) : Collections.singletonList(fleaMarket.sellDetail));
        auditObject.setImgList(fleaMarket.imgList);

        return auditObject;
    }
}
